package com.googlecode.gwtbb.server.dao.forum;

import com.googlecode.gwtbb.client.shared.entity.forum.Post;
import com.googlecode.gwtbb.server.dao.DaoIbatis;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since May 5, 2008
 */
@SuppressWarnings({"unchecked"})
@Transactional
public class PostDaoIbatis extends DaoIbatis<Post> implements PostDao {
	public String getSqlNamespace() {
		return "gwtbb.post";
	}

	public List<Post> selectPostsByThreadId(Long threadId) {
		return (List<Post>)getSqlMapClientTemplate().queryForList(getSqlNamespace() + ".selectPostsByThreadId", threadId);
	}

	public List<Post> selectThreadsByForumId(Long forumId) {
		return (List<Post>)getSqlMapClientTemplate().queryForList(getSqlNamespace() + ".selectThreadsByForumId", forumId);
	}
}